from typing import List

from fastapi import Query
from pydantic import BaseModel, Field
from typing_extensions import Literal

from forward.common.enums import PolicyTypeEnum
from forward.api.pc.schemas.article import ArticleDetailOutSchema


class IndexOutSchema(BaseModel):
    """
    首页数据
    """

    domain: str
    pages: str
    article: List[ArticleDetailOutSchema]
    page: list[int]
    all: list[int]
    new: list[int]
    hot: list[int]


class PolicyInSchema(BaseModel):
    """
    隐私政策入参
    """

    type: PolicyTypeEnum


# class PolicyIn(BaseModel):
#     """协议参数"""
#     type: Literal['service', 'privacy'] = Query()


class CommonProtocolSchema(BaseModel):
    """
    政策通用参数
    """

    name: str  # 名称
    content: str  # 内容


class PolicyOutSchema(BaseModel):
    """
    隐私政策
    """


class SearchInSchema(BaseModel):
    """搜索参数"""

    keyword: str = Query()


class DecorateInSchema(BaseModel):
    """装修参数"""

    id: int = Query(gt=0)  # 主键


class DecorateOutSchema(BaseModel):
    """装修返回"""

    type: int = Field(alias="page_type")  # 页面类型
    name: str = Field(alias="page_name")  # 页面名称
    pages: str = Field(alias="page_data")  # 页面数据
